home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / amos / AMOSL0495.lzh / AMOSLIST / 000104_amos-request@svcs1.digex.net_Sat Apr 22 20:13:54 1995.msg < prev    next >
Internet Message Format  |  1995-05-01  |  2KB

  1. Received: from svcs1.digex.net by nfs1.digex.net with SMTP id AA05384
  2.   (5.67b8/IDA-1.5); Sat, 22 Apr 1995 20:13:53 -0400
  3. Received: by svcs1.digex.net id AA13317
  4.   (5.67b8/IDA-1.5 for amos-out); Sat, 22 Apr 1995 14:43:38 -0400
  5. Received: from nfs2.digex.net by svcs1.digex.net with SMTP id AA13313
  6.   (5.67b8/IDA-1.5 for <amos@svcs1.digex.net>); Sat, 22 Apr 1995 14:43:36 -0400
  7. Received: from goober.mbhs.edu by nfs2.digex.net with SMTP id AA08391
  8.   (5.67b8/IDA-1.5 for <amos-list@access.digex.net>); Sat, 22 Apr 1995 14:43:35 -0400
  9. Received: from dragon.mbhs.edu by goober.mbhs.edu (AIX 3.2/UCB 5.64/4.03)
  10.           id AA45252; Sat, 22 Apr 1995 14:45:20 -0400
  11. Date: Sat, 22 Apr 1995 14:45:20 -0400
  12. Message-Id: <9504221845.AA45252@goober.mbhs.edu>
  13. From: achurch@dragon.mbhs.edu (Andy Church)
  14. To: amos-list@access.digex.net
  15. Subject: Re: If vs On Proc
  16. Reply-To: achurch@goober.mbhs.edu
  17. X-Mailer: MMail v4.21
  18. Status: O
  19. X-Status: 
  20.  
  21. >I was wondering about which of these three routines 
  22. >that are faster:
  23. >
  24. >1)
  25. >    ...
  26. >    MK=Mouse Key
  27. >    MC=Mouse Click
  28. >    If MC<>0
  29. >      If MC=2
  30. >        If MK=3
  31. >          ...
  32. >        Else
  33. >          ...
  34. >        End If
  35. >      Else
  36. >        If MK=3
  37. >          ...
  38. >        Else
  39. >          ...
  40. >        End If
  41. >    Else
  42. >      If MK=1
  43. >        ...
  44. >      Else
  45. >        ...
  46. >      End If
  47. >    End If
  48. >    ...
  49. >
  50. >
  51. >2)
  52. >    ...
  53. >    MK=Mouse Key
  54. >    MC=Mouse Click
  55. >    If MC=2 and MK=3 then ...
  56. >    If MC=2 and MK<>3 then ...
  57. >    If MC=1 and MK=3 then ...
  58. >    If MC=1 and MK<>3 then ...
  59. >    ...
  60. >
  61. >
  62. >3)
  63. >    ...
  64. >    MICE=Mouse Click
  65. >    Rol.b 2,MICE
  66. >    Add MICE,Mouse Key
  67. >    On MICE Proc ZIP,ZIP,ZIP,ZIP,MICE_5,ZIP,MICE_7,...
  68. >    ...
  69. >
  70. >All three has both good and bad sides,but
  71. >which one is faster?
  72.  
  73.   3 is fastest, then 1, then 2.
  74.  
  75. >I've heard that procedures should be avoided to make
  76. >routines faster.Is it true always or is it true only on
  77. >events like when a procedure is returning or receiving an
  78. >argument? 
  79.  
  80.   Well, then you've heard completely wrong.  Procedures should *never* be
  81. avoided; in fact, they should be utilized as much as possible to make your
  82. code more readable and modular.  It's true that not using procedures
  83. increases the speed of your code by a *very* small amount, but if you have
  84. something that's so speed-critical that you'd want to avoid even that
  85. overhead, you should be doing it in assembler anyway.
  86.  
  87.   --Andy Church (achurch@goober.mbhs.edu)
  88.     WWW: http://www.mbhs.edu/~achurch/
  89.     AMOS Web Site: http://www.mbhs.edu/~achurch/amos/